home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / msql-1.0.6 / src / tests / cachetest next >
Text File  |  1994-09-07  |  1KB  |  47 lines

  1. #!/bin/sh
  2. #
  3. #  This script beats the internal table caching code around the ears a
  4. #  few times.  It constantly forces the caches to be rolled and
  5. #  reloaded.  Run it using "cachetest dbname" where dbname is a database
  6. #  that exists and doesn't have tables called test1 test2 or test3 in it.
  7. #
  8. #                            bambi
  9.  
  10. CREATE1="create table test1 ( name char(40), num int)"
  11. CREATE2="create table test2 ( name char(40), num int)"
  12. CREATE3="create table test3 ( name char(40), num int)"
  13. DROP1="drop table test1"
  14. DROP2="drop table test2"
  15. DROP3="drop table test3"
  16.  
  17. NUM_CYCLES=20
  18. COUNT=0
  19. DB=$1
  20.  
  21. if test "$DB." = "."
  22. then
  23.         echo
  24.         echo "Bad usage.  Please read the intro to the script."
  25.         echo
  26.         exit 1
  27. fi
  28.  
  29. while test $COUNT -lt $NUM_CYCLES
  30. do
  31.         echo "$DROP2 \p\g" | (../msql/msql $DB)
  32.         echo "$CREATE1 \p\g" | (../msql/msql $DB)
  33.     ../msql/relshow $DB test1 > /dev/null
  34.         echo "$DROP3 \p\g" | (../msql/msql $DB)
  35.         echo "$CREATE2 \p\g" | (../msql/msql $DB)
  36.     ../msql/relshow $DB test2 > /dev/null
  37.         echo "$DROP1 \p\g" | (../msql/msql $DB)
  38.         echo "$CREATE3 \p\g" | (../msql/msql $DB)
  39.     ../msql/relshow $DB test3 > /dev/null
  40.     COUNT=`expr $COUNT + 1`
  41. done
  42.  
  43. echo "$DROP1 \p\g" | (../msql/msql $DB)
  44. echo "$DROP2 \p\g" | (../msql/msql $DB)
  45. echo "$DROP3 \p\g" | (../msql/msql $DB)
  46.  
  47.